abstract class Shape {
    public abstract void draw();
}
class Rect extends Shape {

    @Override
    public void draw() {
        System.out.println("画矩形");
    }
}
class Cycle extends Shape {

    @Override
    public void draw() {
        System.out.println("画圆形");
    }
}
class Flower extends Shape {

    @Override
    public void draw() {
        System.out.println("画❀");
    }
}
public class Test2 {
    public static void drawMap(Shape shape) {//引用
        shape.draw();
    }
    public static void main(String[] args) {
        Cycle cycle = new Cycle();
        Flower flower = new Flower();
        drawMap(cycle);
        drawMap(flower);

        System.out.println("=========");
        Shape[] shapes = {cycle,flower};
        for (Shape shape:shapes) {
            shape.draw();
        }
    }
}
